2/7/23
Q: for the last part of lecture 07, I tried glance(m_ht_wt) but it didn’t work because m_ht_wt doesn’t exist. Is “m_ht_wt” supposed be a model?
A: Yup, this model was the height by weight model:
Q: I was not too sure what was going on when talking about the relationship between painting height and school.
A: I don’t think you were the only one confused! Briefly here (and I’m happy to chat more before/after class and in OH), we were looking to determine/quantify the relationship between the size (height) of a painting and the school from which the painting originated. This was an example of having more than two categories for a categorical (factor) predictor. The important points were undersatnding that each level is compared to the baseline and the linear model that results from multiple categories. Part 4 of the lab gets into this a bit more too. Definitely follow up if you’re unsure after doing that part of the lab!
Q: How do you calculate the linear regression model when you have non-numeric values? For example, on lab 04, when it asks to calculate the linear regression model by gender, the gender appears only as male and female. Suppose male is 1 and female is 0 (interpreted by the function), then male linear regression model is y =ax + 1?
A: Close! the “1” would be plugged in as the value of x (in what you suggested)m not for the intercept. So the function would be \(y=\beta_1*1 + \beta_0\)
❓ What does it mean to “consider your audience?”
Simply: You do the work so they don’t have to.
…also the aesthetic-usability effect exists.
General Audience
✔ background
🚫 limit technical details
🎉 emphasize take-home
Technical Audience
⬇ limit background
💻 all-the-details
🎉 emphasize take-home
On presentations: Balance b/w short and informative (goal: concise)
Avoid: “Analyzing NHANES”
Better: “Data from the NHANES study shows that diet is related to overall health”
On visualizations: emphasize the take-home! (what’s learned or what action to take)
Avoid: “Boxplot of gender”
Better: “Twice as many females as males included for analysis”
Avoid: “Tickets vs. Time”
Better: “Staff unable to respond to incoming tickets; need to hire 2 FTEs”
Brainstorm: Advice You’ve Been Given?
Student responses will be added to notes after class…
To accomplish:
don’t read directly off slides
repetition is ok: tell what you’re going to tell them, tell them, tell them what you told them
use animation to build your story (not to distract)
introduce your axes
text/labels larger
watch your speech speed
practice!
Brainstorm: Advice You’ve Been Given?
Student responses will be added to notes after class…
Your audience has time to process…but the explanation has to be there!
Visually: more on a single visualization
Yes, often there are different visualizations for reports/papers than for presentations/lectures.
❓ What makes this an effective visualization for a written communication?”
Source: Storytelling wtih data by cole nussbaumer knaflic
---
title: "Document Title"
output:
html_document:
toc: true
toc_float: true
---
---
title: "Document Title"
output:
html_document:
theme: united
highlight: tango
---
---
title: "Document Title"
output:
html_document:
fig_width: 7
fig_height: 6
fig_caption: true
---
---
title: "Document Title"
output:
html_document:
code_folding: hide
---
eval: whether to execute the code chunkecho: whether to include the code in the outputwarning, message, and error: whether to show warnings, messages, or errors in the knit documentfig.width and fig.height: control the width/height of plotsknitr::opts_chunk$set(fig.width = 8, collapse = TRUE)
When are citations needed?
“We will be doing our analysis using two different data sets created by two different groups: Donohue and Mustard + Lott, or simply Lott”
“What turned from the idea of carrying firearms to protect oneself from enemies such as the British monarchy and the unknown frontier of North America has now become a nationwide issue.”
“Right to Carry Laws refer to laws that specify how citizens are allowed to carry concealed handguns when they’re away from home without a permit”
“In this case study, we are examining the relationship between unemployment rate, poverty rate, police staffing, and violent crime rate.”
“In the United States, the second amendment permits the right to bear arms, and this law has not been changed since its creation in 1791.”
“The Right to Carry Laws (RTC) is defined as”a law that specifies if and how citizens are allowed to have a firearm on their person or nearby in public.””
Reminder: You do NOT get docked points for citing others’ work. You can be at risk of AI Violation if you don’t. When in doubt, give credit.
How to specify a footnote in text:
Here is some body text.[^1]
How to include the footnote’s reference:
[^1]: This footnote will appear at the bottom of the page.
Brainstorm: Advice You’ve Been Given?
Student responses will be added to notes after class…
😬 Accurate
😍 Effective
ggplot(penguins, aes(x = species, fill = species)) +
geom_bar() +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1),
plot.title.position = "plot")😬 Accurate
ggplot(penguins, aes(x = species, fill = species)) +
geom_bar() +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1),
plot.title.position = "plot")😬 Accurate
😬 Accurate
😍 Effective
ggplot(penguins, aes(y = fct_rev(fct_infreq(species)), fill = species)) +
geom_bar() +
geom_text(stat='count', aes(label=..count..), hjust = 1.5, color = "white", size = 6) +
scale_x_continuous(expand = c(0, 0)) +
scale_fill_manual(values = c("#454545", rep("#adadad", 2))) +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme_minimal(base_size = 18) +
theme(axis.text.x = element_blank(),
plot.title.position = "plot",
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title = element_blank()) 😬 Accurate
ggplot(penguins, aes(y = fct_rev(fct_infreq(species)), fill = species)) +
geom_bar() +
geom_text(stat='count', aes(label=..count..), hjust = 1.5, color = "white", size = 6) +
scale_x_continuous(expand = c(0, 0)) +
scale_fill_manual(values = c("#454545", rep("#adadad", 2))) +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme_minimal(base_size = 18) +
theme(axis.text.x = element_blank(),
plot.title.position = "plot",
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title = element_blank())😍 Effective
ggplot(penguins, aes(y = fct_rev(fct_infreq(species)), fill = species)) +
geom_bar() +
geom_text(stat='count', aes(label=..count..), hjust = 1.5, color = "white", size = 7) +
scale_x_continuous(expand = c(0, 0)) +
scale_fill_manual(values = c("#454545", rep("#adadad", 2))) +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme_minimal(base_size = 20) +
theme(axis.text.x = element_blank(),
plot.title.position = "plot",
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title = element_blank(),
legend.position = "none")